<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>JSONP</title>
</head>

<body>
  <script>
    function destruction() {
      this.src = null;
      this.onload = null;
      this.parentNode.removeChild(this);
    }
    function jsonp(src) {
      const scriptElement = document.createElement("script");
      scriptElement.src = src;
      scriptElement.onload = destruction;
      document.body.appendChild(scriptElement);
    }
  </script>

  <script>
    function callback({ data }) {
      console.log(data)
    }
    jsonp("http://localhost:5000/?cb=callback");
  </script>
</body>

</html>
